<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>Hello MUI</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="css/classification.css" />

		<!--标准mui.css-->
		<link rel="stylesheet" href="css/mui.min.css" />
		<!--App自定义的css-->
		<!--<link rel="stylesheet" type="text/css" href="../css/app.css" />-->
	</head>

	<body>

		<style>
			.mui-control-content {
				background-color: white;
				min-height: 615px;
			}
			
			.mui-control-content .mui-loading {
				margin-top: 50px;
			}
		</style>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">分类</h1>
		</header>
		<div class="mui-content">
			<div id="slider" class="mui-slider">
				<div id="sliderSegmentedControl" class="mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
					<a class="mui-control-item " href="#item1mobile">
						剧情
					</a>
					<a class="mui-control-item" href="#item2mobile">
						奇幻
					</a>
					<a class="mui-control-item" href="#item3mobile">
						搞笑
					</a>
					<a class="mui-control-item" href="#item4mobile">
						动作
					</a>
					<a class="mui-control-item" href="#item5mobile">
						日常
					</a>
					<a class="mui-control-item" href="#item6mobile">
						浪漫
					</a>
				</div>
				<div id="sliderProgressBar" class="mui-slider-progress-bar mui-col-xs-2"></div>
				<div class="mui-slider-group">
					<div id="item1mobile" class="mui-slider-item mui-control-content mui-active">
						<div id="scroll1" class="mui-scroll-wrapper">
							<div class="mui-scroll">

								<ul class="mui-table-view">
									<li id="juqing" class="mui-table-view-cell">

									</li>

								</ul>
							</div>
						</div>
					</div>
					<div id="item2mobile" class="mui-slider-item mui-control-content">
						<div id="scroll2" class="mui-scroll-wrapper">
							<div class="mui-scroll">
							
								<ul class="mui-table-view">
											<li id="qihuan" class="mui-table-view-cell">

											</li>
								</ul>
							</div>
						</div>

					</div>
					<div id="item3mobile" class="mui-slider-item mui-control-content">
						<div id="scroll3" class="mui-scroll-wrapper">
							<div class="mui-scroll">
								
								<ul class="mui-table-view">
											<li id="gaoxiao" class="mui-table-view-cell">

											</li>

										</ul>
							</div>
						</div>

					</div>
					<div id="item4mobile" class="mui-slider-item mui-control-content ">
						<div id="scroll4" class="mui-scroll-wrapper">
							<div class="mui-scroll">
								
								<ul class="mui-table-view">
											<li id="dongzuo" class="mui-table-view-cell">

											</li>

										</ul>
							</div>
						</div>
					</div>
					<div id="item5mobile" class="mui-slider-item mui-control-content">
						<div id="scroll5" class="mui-scroll-wrapper">
							<div class="mui-scroll">
							
								<ul class="mui-table-view">
											<li id="richang" class="mui-table-view-cell">

											</li>

										</ul>
							</div>
						</div>

					</div>
					<div id="item6mobile" class="mui-slider-item mui-control-content">
						<div id="scroll6" class="mui-scroll-wrapper">
							<div class="mui-scroll">
							
									<ul class="mui-table-view">
											<li id="langman" class="mui-table-view-cell">

											</li>

										</ul>
							</div>
						</div>

					</div>
				</div>
			</div>

		</div>
		<script src="js/url.js"></script>
		<script src="js/jquery.min.js"></script>
		<script>
			/*  如果你要用jQuery必须将下面这行代码放在第一行，然后将$符号换成jQuery
																								 * */
			$.noConflict();

			/*<div class='comics'>
			<img class='pic' src="img/kui.jpg" />
			<span class='bookname'>左拐</span>
			<img src="img/dianzan1.png" class='like' />
			</div>*/

			var li = document.getElementById('juqing');
			jQuery.ajax({
				type: 'post',
				url: serverip.ip + '/discover/category',
				dataType: 'json',
				data: {
					category:'剧情'
				},
				xhrFields: {
					withCredentials: true
				},
				crossDomain: true,

				success: function(data){
					li.innerHTML=null;
					for(var i = 0; i < data.length; i++) {
						var content = document.createElement('div');
						content.classList.add('juqing');
						content.innerHTML = '<div class="comics">' +
							'<img class="pic" src="' +serverip.ip2+data[i]+'/'+ data[i].icon + '" />' +
							'<span class="bookname">' + data[i].comicsname + '</span>' +
							'<span class="mui-icon-extra mui-icon-extra-like like" />' + data[i].easyLike +
							'</div><div class="comicsid" style="display:none;">' + data[i].id + '</div>';

						li.appendChild(content);
					}

					jQuery(".juqing").bind("tap", function() {
						var id = jQuery(this).find('.comicsid:first').text();
						mui.openWindow({
							url: 'commandComics.html',
							extras: {
								comicsid: id
							}
						})
					});

				}
			});
		</script>

		<script src="js/mui.min.js"></script>
		<script>
			mui.init({
				swipeBack: false
			});
			(function($) {
				$('.mui-scroll-wrapper').scroll({
					indicators: true //是否显示滚动条
				});
                
                var item2=document.getElementById('item2mobile');
                var item3=document.getElementById('item3mobile');
                var item4=document.getElementById('item4mobile');
                var item5=document.getElementById('item5mobile');
                var item6=document.getElementById('item6mobile');
				document.getElementById('slider').addEventListener('slide', function(e) {
					if(e.detail.slideNumber === 1) {
						if(item2.querySelector('.mui-scroll')) {
							setTimeout(function() {

								var li = document.getElementById('qihuan');
								jQuery.ajax({
									type: 'post',
									url: serverip.ip + '/discover/category',
									dataType: 'json',
									data: {
										category: '奇幻'
									},
									xhrFields: {
										withCredentials: true
									},
									crossDomain: true,

									success: function(data) {
										li.innerHTML=null;
										for(var i = 0; i < data.length; i++) {
											var content = document.createElement('div');
											content.classList.add('qihuan');
											content.innerHTML = '<div class="comics">' +
												'<img class="pic" src="' + serverip.ip2+data[i]+'/'+ data[i].icon + '" />' +
												'<span class="bookname">' + data[i].comicsname + '</span>' +
												'<span class="mui-icon-extra mui-icon-extra-like like" />' + data[i].easyLike +
												'</div><div class="comicsid" style="display:none;">' + data[i].id + '</div>';

											li.appendChild(content);
										}

										jQuery(".qihuan").bind("tap", function() {
											var id = jQuery(this).find('.comicsid:first').text();
											mui.openWindow({
												url: 'commandComics.html',
												extras: {
													comicsid: id
												}
											})
										});

									}
								});

							}, 500);
						}
					} else if(e.detail.slideNumber === 2) {
						if(item3.querySelector('.mui-scroll')) {
							setTimeout(function() {
								var li = document.getElementById('gaoxiao');
								jQuery.ajax({
									type: 'post',
									url: serverip.ip + '/discover/category',
									dataType: 'json',
									data: {
										category: '搞笑'
									},
									xhrFields: {
										withCredentials: true
									},
									crossDomain: true,

									success: function(data) {
										li.innerHTML=null;
										for(var i = 0; i < data.length; i++) {
											var content = document.createElement('div');
											content.classList.add('gaoxiao');
											content.innerHTML = '<div class="comics">' +
												'<img class="pic" src="' + serverip.ip2+data[i]+'/'+ data[i].icon + '" />' +
												'<span class="bookname">' + data[i].comicsname + '</span>' +
												'<span class="mui-icon-extra mui-icon-extra-like like" />' + data[i].easyLike +
												'</div><div class="comicsid" style="display:none;">' + data[i].id + '</div>';

											li.appendChild(content);
										}

										jQuery(".gaoxiao").bind("tap", function() {
											var id = jQuery(this).find('.comicsid:first').text();
											mui.openWindow({
												url: 'commandComics.html',
												extras: {
													comicsid: id
												}
											})
										});

									}
								});
							
							
							}, 500);
						}

					} else if(e.detail.slideNumber === 3) {
						if(item4.querySelector('.mui-scroll')) {
							setTimeout(function() {
								var li = document.getElementById('dongzuo');
								jQuery.ajax({
									type: 'post',
									url: serverip.ip + '/discover/category',
									dataType: 'json',
									data: {
										category: '动作'
									},
									xhrFields: {
										withCredentials: true
									},
									crossDomain: true,

									success: function(data) {
										li.innerHTML=null;
										for(var i = 0; i < data.length; i++) {
											var content = document.createElement('div');
											content.classList.add('dongzuo');
											content.innerHTML = '<div class="comics">' +
												'<img class="pic" src="' + serverip.ip2+data[i]+'/'+ data[i].icon + '" />' +
												'<span class="bookname">' + data[i].comicsname + '</span>' +
												'<span class="mui-icon-extra mui-icon-extra-like like" />' + data[i].easyLike +
												'</div><div class="comicsid" style="display:none;">' + data[i].id + '</div>';

											li.appendChild(content);
										}

										jQuery(".dongzuo").bind("tap", function() {
											var id = jQuery(this).find('.comicsid:first').text();
											mui.openWindow({
												url: 'commandComics.html',
												extras: {
													comicsid: id
												}
											})
										});

									}
								});
							}, 500);
						}

					} else if(e.detail.slideNumber === 4) {
						if(item5.querySelector('.mui-scroll')) {
							setTimeout(function() {
								var li = document.getElementById('richang');
								jQuery.ajax({
									type: 'post',
									url: serverip.ip + '/discover/category',
									dataType: 'json',
									data: {
										category: '日常'
									},
									xhrFields: {
										withCredentials: true
									},
									crossDomain: true,

									success: function(data) {
										li.innerHTML=null;
										for(var i = 0; i < data.length; i++) {
											var content = document.createElement('div');
											content.classList.add('richang');
											content.innerHTML = '<div class="comics">' +
												'<img class="pic" src="' + serverip.ip2+data[i]+'/'+ data[i].icon + '" />' +
												'<span class="bookname">' + data[i].comicsname + '</span>' +
												'<span class="mui-icon-extra mui-icon-extra-like like" />' + data[i].easyLike +
												'</div><div class="comicsid" style="display:none;">' + data[i].id + '</div>';

											li.appendChild(content);
										}

										jQuery(".richang").bind("tap", function() {
											var id = jQuery(this).find('.comicsid:first').text();
											mui.openWindow({
												url: 'commandComics.html',
												extras: {
													comicsid: id
												}
											})
										});

									}
								});
							}, 500);
						}
					} else if(e.detail.slideNumber === 5) {
						if(item6.querySelector('.mui-scroll')) {
							setTimeout(function() {
								var li = document.getElementById('langman');
								jQuery.ajax({
									type: 'post',
									url: serverip.ip + '/discover/category',
									dataType: 'json',
									data: {
										category: '浪漫'
									},
									xhrFields: {
										withCredentials: true
									},
									crossDomain: true,

									success: function(data) {
										li.innerHTML=null;
										for(var i = 0; i < data.length; i++) {
											var content = document.createElement('div');
											content.classList.add('langman');
											content.innerHTML = '<div class="comics">' +
												'<img class="pic" src="' + serverip.ip2+data[i]+'/'+ data[i].icon + '" />' +
												'<span class="bookname">' + data[i].comicsname + '</span>' +
												'<span class="mui-icon-extra mui-icon-extra-like like" />' + data[i].easyLike +
												'</div><div class="comicsid" style="display:none;">' + data[i].id + '</div>';

											li.appendChild(content);
										}

										jQuery(".langman").bind("tap", function() {
											var id = jQuery(this).find('.comicsid:first').text();
											mui.openWindow({
												url: 'commandComics.html',
												extras: {
													comicsid: id
												}
											})
										});

									}
								});
							}, 500);
						}
					}

				});
				var sliderSegmentedControl = document.getElementById('sliderSegmentedControl');
				$('.mui-input-group').on('change', 'input', function() {
					if(this.checked) {
						sliderSegmentedControl.className = 'mui-slider-indicator mui-segmented-control mui-segmented-control-inverted mui-segmented-control-' + this.value;
						//force repaint
						sliderProgressBar.setAttribute('style', sliderProgressBar.getAttribute('style'));
					}
				});
			})(mui);
		</script>

	</body>

</html>
